﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ComDevFx.Arch.Base.Logger
{
    public class LoggerManger
    {
        private readonly log4net.ILog _logger;
        private readonly string _logName = string.Empty;

        public LoggerManger(string loggerName)
        {
            _logName = loggerName;
            _logName = string.IsNullOrEmpty(_logName) ? this.GetType().FullName : _logName;
            _logger = log4net.LogManager.GetLogger(_logName);
        }

        
        public void AddLog(RuntimeLogType logType, string log)
        {
            switch (logType)
            {
                case  RuntimeLogType.Debug:
                    _logger.Debug(log);
                    break;
                case RuntimeLogType.Info:
                    _logger.Info(log);
                    break;
                case RuntimeLogType.Warn:
                    _logger.Warn(log);
                    break;
                case RuntimeLogType.Error:
                    _logger.Error(log);
                    break;
                case RuntimeLogType.Fatal:
                    _logger.Fatal(log);
                    break;
            }
        }
    }

    public  enum  RuntimeLogType
    {
        Debug,
        Info, 
        Warn, 
        Error, 
        Fatal
    }
}
